package cn.sdormitory.service.impl;

import cn.sdormitory.service.AppAttenceExceptionService;
import cn.sdormitory.smartdor.dao.SdAttenceExceptionDao;
import cn.sdormitory.smartdor.entity.SdAttenceException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @创建人：zhouyang
 * @创建时间：2020/12/30 17:56
 * @version：V1.0
 */
@Service
public class AppAttenceExceptionServiceImpl extends ServiceImpl<SdAttenceExceptionDao, SdAttenceException> implements AppAttenceExceptionService {
    @Resource
    private SdAttenceExceptionDao sdAttenceExceptionDao;

    @Override
    public SdAttenceException getAppException(String studentNo, String createTime) {
        return sdAttenceExceptionDao.getAppException(studentNo,createTime);
    }

    @Override
    public SdAttenceException getAttenceExcById(Long id) {
        return sdAttenceExceptionDao.selectOne(new LambdaQueryWrapper<SdAttenceException>().eq(SdAttenceException::getId,id));
    }

    @Override
    public List<SdAttenceException> getAppExcList() {
        return sdAttenceExceptionDao.getAppExcList();
    }

    @Override
    public int insert(SdAttenceException sdAttenceException) {
        return sdAttenceExceptionDao.insert(sdAttenceException);
    }

    @Override
    public SdAttenceException getByStuNoAndDate(String studentNo) {
        return sdAttenceExceptionDao.getByStuNoAndDate(studentNo);
    }

    @Override
    public SdAttenceException getAppExceptionById(Long id) {
        return sdAttenceExceptionDao.getAppExceptionById(id);
    }

    @Override
    public int delete(Long id) {
        return this.baseMapper.deleteById(id);
    }

    @Override
    public int updateAttenceExc(Long id, String absenceProcessStatus, String processDesc) {
        SdAttenceException sdAttenceException=new SdAttenceException();
        sdAttenceException.setId(id);
        sdAttenceException.setAbsenceProcessStatus(absenceProcessStatus);
        sdAttenceException.setProcessDesc(processDesc);
        return this.baseMapper.updateById(sdAttenceException);
    }
}
